<admintpl file="header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:U('Admin/Vote/index')}">投票统计</a></li>
    </ul>

    <form class="well form-search" id="query_form" method="post" action="{:U('Admin/Vote/index')}">
        投票标题：
        {$vote_info['title']}
        <br/><br/>
        投票总人数：
        {$vote_info['ballot_count']}
        <br/><br/>
        <a href="{:U('Admin/Vote/ExportExcel', array('id'=>I('id')))}" class="btn btn-primary" >导出excel</a>
    </form>

    <?php if($list){ ?>
        <form class="js-ajax-form" action="" method="post">
            <table class="table table-hover table-bordered">
                <thead>
                <tr>
                    <th>名称</th>
                    <th>所在组</th>
                    <th>所在类</th>
                    <th>总票数
                        <a style="margin: auto;" href="{:U('vote/statistical', array('id'=>I('id'), 'sort'=>1))}">↑</a>
                        <a style="margin: auto;" href="{:U('vote/statistical', array('id'=>I('id'), 'sort'=>0))}">↓</a>
                    </th>
                </tr>
                </thead>
                <tbody>
                <foreach name="list" item="vo">
                    <tr>
                        <td>{$vo.name}</td>
                        <td>{$vo.group_name}</td>
                        <td>{$vo.class_name}</td>
                        <td>{$vo.ballot_count}</td>
                    </tr>
                </foreach>
                </tbody>
            </table>
        </form>
    <?php }else{ ?>
        <div style="font-size: 20px; text-align: center;">暂无投票</div>
    <?php } ?>
    <div class="pagination">{$page}</div>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script>
<script>
    $("#newsDel").click(function(){
        var boxes = $("[name='news_ids[]']");
        var news_checbox = []
        for(i=0;i<boxes.length;i++){
            if(boxes[i].checked == true){
                news_checbox.push(boxes[i].value);
            }
        }

        if(news_checbox == ''){
            alert('请选择要删除的投票!');
            return false;
        }
        $.post("<?php echo U('Admin/Vote/VoteDel')?>",{news_checbox:news_checbox},function(result){
            if(result > '0'){
                var msg = '删除成功';
            }else{
                var msg = '删除失败';
            }

            alert(msg);
            location.reload();
        });
    })
</script>
</body>
</html>